﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Drawing;
using System.Data;
using System.Text;
using System.Windows.Forms;
using DevExpress.XtraEditors;
using ERP_RORZE_DLL.Product.DAO;
using ERP_RORZE_DLL.Product.database;

namespace ERP_RORZE.Product.PartHandling
{
    public partial class ctrlAnodInspDetail : DevExpress.XtraEditors.XtraUserControl
    {
        ClsPartHandlingDAO clsParthandinhDAO = new ClsPartHandlingDAO();
        DataTable dt;
        ClsDAnodInspTable obj = new ClsDAnodInspTable();
        public ctrlAnodInspDetail()
        {
            InitializeComponent();
        }

        private void ctrlAnodInspDetail_Load(object sender, EventArgs e)
        {
            Re_load(sender, e);
        }
        void Re_load(object sender, EventArgs e)
        {
            dt = clsParthandinhDAO.GetAllAnodInspDetail();
            gridControl1.DataSource = dt;
        }
        private void btnReload_Click(object sender, EventArgs e)
        {
            Re_load(sender, e);
        }

        private void btnDelete_Click(object sender, EventArgs e)
        {

            obj.ID = int.Parse(gridView1.GetRowCellValue(gridView1.FocusedRowHandle, "ID").ToString());
            clsParthandinhDAO.DeleteDAnodInspDetail(obj);
            Re_load(sender, e);
        }

        private void btnInput_Click(object sender, EventArgs e)
        {
            frm_AnodInspInput frmAdd = new frm_AnodInspInput();
            frmAdd.Reload += new EventHandler(Re_load);
            frmAdd.Show();
        }

        private void gridControl1_Load(object sender, EventArgs e)
        {
            Re_load(sender, e);
        }

        private void btnRefresh_Click(object sender, EventArgs e)
        {
            Re_load(sender, e);
        }

        private void btnAddNew_Click(object sender, EventArgs e)
        {
            btnInput_Click(sender, e);
        }

        private void btDelete_Click(object sender, EventArgs e)
        {
            btnDelete_Click(sender, e);
        }
    }
}
